package com.example.mysql.rest;

import com.example.mysql.config.IdGenerator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author void
 * @date 2021/2/26 16:18
 * @desc
 */
@RestController
public class UidController {

    @Autowired
    private IdGenerator idGenerator;

    @GetMapping("/testGet")
    public Long testGet(){
        return idGenerator.nextId();
    }

    @GetMapping("/testParse/{uid}")
    public String testParse(@PathVariable("uid") Long uid){
        return idGenerator.parse(uid);
    }

}
